package com.runa.persistence.service;

import com.runa.monitor.comm.entity.CommMeter;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 2024/6/25 14:21
 * zhangYB
 */
@Slf4j
public class BatchService {


    private static final Integer BATCH_QUERY_COUNT = 10000;


    public List<List<String>> getSubIdsList(List<String> ids) {
        log.debug("批量: {}", ids.size());
        List<List<String>> subIdsList = new ArrayList<>();
        int len = ids.size();
        for (int i = 0; i < len; i=i+BATCH_QUERY_COUNT) {
            int toIndex = Math.min((i + BATCH_QUERY_COUNT), len);
            List<String> subIds = ids.subList(i, toIndex);
            log.debug("subIds数量: {}", subIds.size());
            subIdsList.add(subIds);
        }
        return subIdsList;
    }





}
